using System;

namespace Velocity4Net.Runtime
{

    /// <summary>
    /// This class defines the keys that are used in the
    /// velocity.properties file so that they can be referenced as a constant
    /// within Java code.
    /// </summary>
    /// <author> <a href="mailto:jon@latchkey.com">Jon S. Stevens</a></author>
    /// <author> <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a></author>
    /// <author> <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a></author>
    public class RuntimeConstants
    {
        /** Location of the velocity log file. */
        public const String RUNTIME_LOG = "runtime.log";

        /** externally provided logger. */
        public const String RUNTIME_LOG_LOGSYSTEM = "runtime.Logsystem";

        /** class of log system to use. */
        public const String RUNTIME_LOG_LOGSYSTEM_CLASS = "runtime.Logsystem.class";

        /**
         * Properties referenced in the template are required to exist the object
         */
        public const string RUNTIME_REFERENCES_STRICT = "runtime.references.strict";

        /**
         * Indicates we are going to use modifed escape behavior in strict mode
         */
        public const string RUNTIME_REFERENCES_STRICT_ESCAPE = "runtime.references.strict.escape";

        /**
         * @deprecated  This appears to have always been meaningless.
         */
        public const String RUNTIME_LOG_ERROR_STACKTRACE = "runtime.log.error.stacktrace";

        /**
         * @deprecated  The functionality this controlled is confusing and no longer necessary.
         */
        public const String RUNTIME_LOG_WARN_STACKTRACE = "runtime.log.warn.stacktrace";

        /**
         * @deprecated  This appears to have always been meaningless.
         */
        public const String RUNTIME_LOG_INFO_STACKTRACE = "runtime.log.info.stacktrace";

        /** Logging of invalid references. */
        public const string RUNTIME_LOG_REFERENCE_LOG_INVALID = "runtime.log.invalid.references";

        /**
         * @deprecated  Use LogChute.TRACE_PREFIX instead
         */
        public const string TRACE_PREFIX = " [trace] ";

        /**
         * @deprecated  Use LogChute.DEBUG_PREFIX instead
         */
        public const string DEBUG_PREFIX = " [debug] ";

        /**
         * @deprecated  Use LogChute.INFO_PREFIX instead
         */
        public const string INFO_PREFIX = "  [info] ";

        /**
         * @deprecated  Use LogChute.WARN_PREFIX instead
         */
        public const string WARN_PREFIX = "  [warn] ";

        /**
         * @deprecated  Use LogChute.ERROR_PREFIX instead
         */
        public const string ERROR_PREFIX = " [error] ";

        /**
         * @deprecated  This will be removed in a future version
         */
        public const string UNKNOWN_PREFIX = " [unknown] ";

        /*
         * ----------------------------------------------------------------------
         * D I R E C T I V E  C O N F I G U R A T I O N
         * ----------------------------------------------------------------------
         * Directive properties are of the form:
         *
         * directive.<directive-name>.<property>
         * ----------------------------------------------------------------------
         */

        /** Counter reference name in #foreach directives. */
        public const string COUNTER_NAME = "directive.foreach.counter.name";

        /**
         * Iterator.hasNext() reference name in #foreach directives.
         * @since 1.6
         */
        public const string HAS_NEXT_NAME = "directive.foreach.iterator.name";

        /** Initial counter value in #foreach directives. */
        public const string COUNTER_INITIAL_VALUE = "directive.foreach.counter.initial.value";

        /** Maximum allowed number of loops. */
        public const string MAX_NUMBER_LOOPS = "directive.foreach.maxloops";

        /**
         * Whether to throw an exception or just skip bad iterables. Default is true.
         * @since 1.6
         */
        public const string SKIP_INVALID_ITERATOR = "directive.foreach.skip.invalid";

        /** if set to true then allows #set to accept null values in the right hand side. */
        public const string SET_NULL_ALLOWED = "directive.set.null.allowed";

        /**
         * Indicates if toString() should be called during #if condition evaluation
         * just to ensure it does not return null. Check is unnecessary if all
         * toString() implementations are known to have non-null return values.
         * Disabling the check (like Velocity 1.5 did) will can boost performance
         * since toString() may be a complex operation on large objects.
         * @since 1.6
         */
        public const string DIRECTIVE_IF_TOSTRING_NULLCHECK = "directive.if.tostring.nullcheck";

        /**
         * Starting tag for error messages triggered by passing a parameter not allowed in the #include directive. Only string literals,
         * and references are allowed.
         */
        public const string ERRORMSG_START = "directive.include.output.errormsg.start";

        /**
         * Ending tag for error messages triggered by passing a parameter not allowed in the #include directive. Only string literals,
         * and references are allowed.
         */
        public const string ERRORMSG_END = "directive.include.output.errormsg.end";

        /** Maximum recursion depth allowed for the #parse directive. */
        public const string PARSE_DIRECTIVE_MAXDEPTH = "directive.parse.max.depth";

        /** Maximum recursion depth allowed for the #define directive. */
        public const string DEFINE_DIRECTIVE_MAXDEPTH = "directive.define.max.depth";

        /**
         * class to use for local context with #evaluate()
         * @since 1.6
         */
        public const string EVALUATE_CONTEXT_CLASS = "directive.evaluate.context.class";

        /**
         * Used to suppress various scope control objects.
         * @since 1.7
         */
        public const string PROVIDE_SCOPE_CONTROL = "provide.scope.control";

        /*
         * ----------------------------------------------------------------------
         *  R E S O U R C E   M A N A G E R   C O N F I G U R A T I O N
         * ----------------------------------------------------------------------
         */

        /**  */
        public const string RESOURCE_MANAGER_CLASS = "resource.manager.class";

        /**
         * The <code>resource.manager.cache.class</code> property specifies the name of the
         * {@link org.apache.velocity.runtime.resource.ResourceCache} implementation to use.
         */
        public const string RESOURCE_MANAGER_CACHE_CLASS = "resource.manager.cache.class";

        /** The <code>resource.manager.cache.size</code> property specifies the cache upper bound (if relevant). */
        public const string RESOURCE_MANAGER_DEFAULTCACHE_SIZE = "resource.manager.defaultcache.size";

        /*
         * ----------------------------------------------------------------------
         * R E S O U R C E  L O A D E R  C O N F I G U R A T I O N
         * ----------------------------------------------------------------------
         */

        /** controls if the finding of a resource is logged. */
        public const string RESOURCE_MANAGER_LOGWHENFOUND = "resource.manager.logwhenfound";

        /**
         * Key used to retrieve the names of the resource loaders to be used. In a properties file they may appear as the following:
         *
         * <p>resource.loader = file,classpath</p>
         */
        public const string RESOURCE_LOADER = "resource.loader";

        /** The public handle for setting a path in the FileResourceLoader. */
        public const string FILE_RESOURCE_LOADER_PATH = "file.resource.loader.path";

        /** The public handle for turning the caching on in the FileResourceLoader. */
        public const string FILE_RESOURCE_LOADER_CACHE = "file.resource.loader.cache";

        /*
         * ----------------------------------------------------------------------
         *  E V E N T  H A N D L E R  C O N F I G U R A T I O N
         * ----------------------------------------------------------------------
         */

        /**
         * The <code>eventhandler.referenceinsertion.class</code> property specifies a list of the
         * {@link org.apache.velocity.app.event.ReferenceInsertionEventHandler} implementations to use.
         */
        public const string EVENTHANDLER_REFERENCEINSERTION = "eventhandler.referenceinsertion.class";

        /**
         * The <code>eventhandler.nullset.class</code> property specifies a list of the
         * {@link org.apache.velocity.app.event.NullSetEventHandler} implementations to use.
         */
        public const string EVENTHANDLER_NULLSET = "eventhandler.nullset.class";

        /**
         * The <code>eventhandler.methodexception.class</code> property specifies a list of the
         * {@link org.apache.velocity.app.event.MethodExceptionEventHandler} implementations to use.
         */
        public const string EVENTHANDLER_METHODEXCEPTION = "eventhandler.methodexception.class";

        /**
         * The <code>eventhandler.include.class</code> property specifies a list of the
         * {@link org.apache.velocity.app.event.IncludeEventHandler} implementations to use.
         */
        public const string EVENTHANDLER_INCLUDE = "eventhandler.include.class";

        /**
         * The <code>eventhandler.invalidreferences.class</code> property specifies a list of the
         * {@link org.apache.velocity.app.event.InvalidReferenceEventHandler} implementations to use.
         */
        public const string EVENTHANDLER_INVALIDREFERENCES = "eventhandler.invalidreferences.class";


        /*
         * ----------------------------------------------------------------------
         * V E L O C I M A C R O  C O N F I G U R A T I O N
         * ----------------------------------------------------------------------
         */

        /** Name of local Velocimacro library template. */
        public const string VM_LIBRARY = "velocimacro.library";

        /** Default Velocimacro library template. */
        public const string VM_LIBRARY_DEFAULT = "VM_global_library.vm";

        /** switch for autoloading library-sourced VMs (for development). */
        public const string VM_LIBRARY_AUTORELOAD = "velocimacro.library.autoreload";

        /** boolean (true/false) default true : allow inline (in-template) macro definitions. */
        public const string VM_PERM_ALLOW_INLINE = "velocimacro.permissions.allow.inline";

        /** boolean (true/false) default false : allow inline (in-template) macro definitions to replace existring. */
        public const string VM_PERM_ALLOW_INLINE_REPLACE_GLOBAL = "velocimacro.permissions.allow.inline.to.replace.global";

        /** Switch for forcing inline macros to be local : default false. */
        public const string VM_PERM_INLINE_LOCAL = "velocimacro.permissions.allow.inline.local.scope";

        /** Switch for VM blather : default true. */
        public const string VM_MESSAGES_ON = "velocimacro.messages.on";

        /** switch for local context in VM : default false. */
        public const string VM_CONTEXT_LOCALSCOPE = "velocimacro.context.localscope";

        /** if true, throw an exception for wrong number of arguments **/
        public const string VM_ARGUMENTS_STRICT = "velocimacro.arguments.strict";

        /**
         * Specify the maximum depth for macro calls
         * @since 1.6
         */
        public const string VM_MAX_DEPTH = "velocimacro.max.depth";

        /**
         * Defines name of the reference that can be used to get the AST block passed to block macro calls.
         * @since 1.7
         */
        public const string VM_BODY_REFERENCE = "velocimacro.body.reference";

        /*
         * ----------------------------------------------------------------------
         * G E N E R A L  R U N T I M E  C O N F I G U R A T I O N
         * ----------------------------------------------------------------------
         */

        /** Switch for the interpolation facility for string literals. */
        public const string INTERPOLATE_STRINGLITERALS = "runtime.interpolate.string.literals";

        /** The character encoding for the templates. Used by the parser in processing the input streams. */
        public const string INPUT_ENCODING = "input.encoding";

        /** Encoding for the output stream. Currently used by Anakia and VelocityServlet */
        public const string OUTPUT_ENCODING = "output.encoding";

        /** Default Encoding is ISO-8859-1. */
        public const string ENCODING_DEFAULT = "ISO-8859-1";

        /** key name for uberspector. Multiple classnames can be specified,in which case uberspectors will be chained. */
        public const string UBERSPECT_CLASSNAME = "runtime.introspector.uberspect";

        /** A comma separated list of packages to restrict access to in the SecureIntrospector. */
        public const string INTROSPECTOR_RESTRICT_PACKAGES = "introspector.restrict.packages";

        /** A comma separated list of classes to restrict access to in the SecureIntrospector. */
        public const string INTROSPECTOR_RESTRICT_CLASSES = "introspector.restrict.classes";

        /** Switch for ignoring nulls in math equations vs throwing exceptions. */
        public const string STRICT_MATH = "runtime.strict.math";

        /**
         * The <code>parser.pool.class</code> property specifies the name of the {@link org.apache.velocity.util.SimplePool}
         * implementation to use.
         */
        public const string PARSER_POOL_CLASS = "parser.pool.class";

        /**
         * @see  #NUMBER_OF_PARSERS
         */
        public const string PARSER_POOL_SIZE = "parser.pool.size";

        /*
         * ----------------------------------------------------------------------
         * These constants are used internally by the Velocity runtime i.e.
         * the constants listed below are strictly used in the Runtime
         * class itself.
         * ----------------------------------------------------------------------
         */

        /** Default Runtime properties. */
        public const String DEFAULT_RUNTIME_PROPERTIES = "org/apache/velocity/runtime/defaults/velocity.properties";

        /** Default Runtime properties. */
        public const string DEFAULT_RUNTIME_DIRECTIVES = "org/apache/velocity/runtime/defaults/directive.properties";

        /**
         * The default number of parser instances to create. Configurable via the parameter named by the {@link #PARSER_POOL_SIZE}
         * constant.
         */
        public const int NUMBER_OF_PARSERS = 20;


    }
}
